<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('学生信息管理列表')"/>
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <div class="select-list">
                    <ul>
                        <li>
                            <label>学年：</label>
                            <input type="text" name="inYear" id="inYear"/>
                        </li>
                        <li>
                            <label>学院：</label>
                            <input type="text" name="collegeName"/>
                        </li>
                        <li>
                            <label>专业：</label>
                            <input type="text" name="majorName"/>
                        </li>
                        <li>
                            <label>班级：</label>
                            <input type="text" name="className"/>
                        </li>
                        <li>
                            <label>学号：</label>
                            <input type="text" name="studentNumber"/>
                        </li>
                        <li>
                            <label>学生姓名：</label>
                            <input type="text" name="studentName"/>
                        </li>
                        <li>
                            <label>学生类型：</label>
                            <input type="text" name="studentType"/>
                        </li>
                        <li>
                            <label>性别：</label>
                            <input type="text" name="gender"/>
                        </li>
                        <li>
                            <label>毕业状态：</label>
                            <select name="graduationStatus" id="graduationStatus">
                                <option value="">所有</option>
                                <option value="在校">在校</option>
                                <option value="延期">延期</option>
                                <option value="已毕业">已毕业</option>
                            </select>
                        </li>
                        <li>
                            <label>教师工号：</label>
                            <input type="text" name="teacherNumber"/>
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
                                    class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
                                    class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

        <div class="btn-group-sm" id="toolbar" role="group">
            <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="gas:student:export">
                <i class="fa fa-download"></i> 导出
            </a>
        </div>
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer"/>
<script th:inline="javascript">
    var prefix = ctx + "gas/student/graduate";
    var detailFlag = [[${@permission.hasPermi('gas:student:detail')}]];
    var auditFlag = [[${@permission.hasPermi('gas:student:graduate:audit')}]];

    $(function () {
        var date = new Date();
        var year = date.getFullYear();
        $("#inYear").val(year - 4);
    });

    $(function () {
        var options = {
            url: prefix + "/list",
            detailUrl: "detail/{id}",
            exportUrl: prefix + "/export",
            modalName: "学生信息管理",
            columns: [{
                checkbox: true
            },
                {
                    field: 'studentNumber',
                    title: '学生学号'
                },
                {
                    field: 'studentName',
                    title: '学生姓名'
                },
                {
                    field: 'studentType',
                    title: '学生类型'
                },
                {
                    field: 'gender',
                    title: '性别'
                },
                {
                    field: 'admissionsTime',
                    title: '入学时间'
                },
                {
                    field: 'collegeName',
                    title: '学院名称'
                },
                {
                    field: 'majorName',
                    title: '专业名称'
                },
                {
                    field: 'className',
                    title: '班级名称'
                },
                {
                    field: 'graduationStatus',
                    title: '毕业状态',
                    align: 'center',
                    formatter: function (value, row, index) {
                        if(value === "延期"){
                            return '<span style="color: red">' + value + '</span>';
                        } else if(value === "在校"){
                            return '<span style="color: #fdd49a">' + value + '</span>';
                        }else{
                            return '<span style="color: green">' + value + '</span>';

                        }
                    }
                },
                {
                    field: 'isExcellent',
                    title: '优秀毕业生',
                    align: 'center',
                    formatter: function (value, row, index) {
                        if(value === "通过"){
                            return "是";
                        }else{
                            return "否";
                        }
                    }
                },
                {
                    field: 'teacherNumber',
                    title: '指导老师工号'
                },
                {
                    field: 'remark',
                    title: '评语',
                    align: 'center',
                    formatter: function (value, row, index) {
                        return $.table.tooltip(value, 10, "open");
                    }
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function (value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-info btn-xs ' + detailFlag + '" href="javascript:void(0)" onclick="$.operate.detail(\'' + row.studentNumber + '\')"><i class="fa fa-info"></i>详情</a> ');
                        actions.push('<a class="btn btn-warning btn-xs ' + auditFlag + '" href="javascript:void(0)" onclick="auditStudent(\'' + row.studentNumber + '\' , \'' + row.studentName + '\')"><i class="fa fa-edit"></i>审核</a> ');
                        // actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.studentNumber + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }
                ]
        };
        $.table.init(options);
    });
    
    function auditStudent(studentNumber,studentName) {
        $.modal.open(studentName + "的毕业审核",prefix + "/audit/" + studentNumber , 300 , 300);
    }
</script>
</body>
<!-- 导入区域 -->
<script id="importTpl" type="text/template">
    <form enctype="multipart/form-data" class="mt20 mb10">
        <div class="col-xs-offset-1">
            <input type="file" id="file" name="file"/>
            <div class="mt10 pt5">
                <!--                <input type="checkbox" id="updateSupport" name="updateSupport" title="如果登录账户已经存在，更新这条数据。"> 是否更新已经存在的用户数据-->
                &nbsp; <a onclick="$.table.importTemplate()" class="btn btn-default btn-xs"><i
                    class="fa fa-file-excel-o"></i> 下载模板</a>
            </div>
            <font color="red" class="pull-left mt10">
                提示：仅允许导入“xls”或“xlsx”格式文件！
            </font>
        </div>
    </form>
</script>
</html>